<script setup>
defineProps({
  item: { type: Object, default: () => {} }
})
</script>

<template>
  <el-table-column
    :type="item.type"
    :label="item.label"
    :prop="item.prop"
    :width="item.width"
    :min-width="item.minWidth"
    :fixed="item.fixed"
    :sortable="item.sortable"
    :formatter="item.formatter"
    :align="item.align"
    :header-align="item.headerAlign"
    :class-name="item.className"
    :label-class-name="item.labelClassName"
    :show-overflow-tooltip="item.showOverflowTooltip"
  >
    <template #default="{ row, $index, column, cellIndex }">
      <slot
        v-if="item.slotName"
        :row="row"
        :index="$index"
        :column="column"
        :cell-index="cellIndex"
        :name="item.slotName"
        :prop="item.prop"
      />
      <template v-else>
        <span v-if="item.filter">{{ item.filter(row[item.prop]) }}</span>
        <span v-else-if="item.render">
          {{ item.render(row[item.prop], row) }}
        </span>
        <span v-else>{{ row[item.prop] }}</span>
      </template>
    </template>
  </el-table-column>
</template>

<style lang="less" scoped></style>
